<me:UIMENU x:Class="WPFExcelReport.TUMENU"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                     xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"      
                    xmlns:ex="clr-namespace:WPFExcelReport.Controls;assembly=ExControls"
                    xmlns:me="clr-namespace:WPFExcelReport" 
                     xmlns:Localization="clr-namespace:Localization;assembly=Localization"
                    xmlns:HR="clr-namespace:WPFExcelReport;assembly=TICC_HRSTAMM" 
                    xmlns:FN="clr-namespace:WPFExcelReport;assembly=TICC_FUNCTIONS" 
                    x:Name="TV"
                    Loaded="Window_Loaded"
     >
    <me:UIMENU.Resources>
        <CollectionViewSource  x:Key="vwMaster"/>       <CollectionViewSource  x:Key="vwDetail"/>
        <ucd:Divideby10  x:Key="d10"/>
        <ucd:BoolToVisibilityConverter  x:Key="bv"/>
        <ucd:Divideby100  x:Key="d100"/>
        <ucd:TIMES100  x:Key="X100"/>
        <ucd:NOTBoolToVisibilityConverter  x:Key="nbv"/>
        <ucd:Divideby1000  x:Key="d1000"/>
        <ucd:PreisConverter  x:Key="PreisConverter"/>
        <ucd:PNumConverter  x:Key="pnum"/>
        <ucd:TextTrimmingConverter  x:Key="Trim"/>
        <ucd:GB2312Convert8859P1  x:Key="gb2312"/>
    </me:UIMENU.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="1*"></RowDefinition>
        </Grid.RowDefinitions>
        <StackPanel Grid.Row="0">
            <WrapPanel>
                <Grid Margin="10,0,0,0"  Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource nbv}}">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button   Click="NewCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Add.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <Grid Margin="10,0,0,0" Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource nbv}}">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button  Click="EditCommand" Width="24" Height="20">
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Edit.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <Grid Margin="10,0,0,0" Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource nbv}}">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button Click="DeleteCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Remove.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <Grid Margin="10,0,0,0" Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource nbv}}">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button    Click="CopyCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/copy.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <Grid Margin="10,0,0,0" Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource bv}}">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button   Click="SaveCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Save.png" />
                        </Button.Background>
                    </Button>
                </Grid>
            </WrapPanel>
            <WrapPanel>
                <TextBlock Text="{Binding ROWNID,Source={StaticResource ResourceKey=vwMaster}}"></TextBlock>
                <Grid Margin="10,0,0,0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock   Grid.Column="0" Text="{Binding Source={Localization:Translate Word=用户:}}"></TextBlock>
                    <HR:TSHR Name="cHR" KEY="{Binding USERID,ElementName=TV}"
                             ORDERNUM="{Binding USERID,ElementName=TV}"
                             />
                </Grid> 
                <WrapPanel>
                    <TextBlock Text="{Binding Source={Localization:Translate Word=位置}}"></TextBlock>
                    <FN:TSFGRP Grid.Column="1" KEY="{Binding FNCGP,ElementName=TV}"/> 
                </WrapPanel>  
            </WrapPanel>
            <WrapPanel>
     
                <Grid Margin="10,0,0,0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock   Grid.Column="0" Text="{Binding Source={Localization:Translate Word=功能:}}"></TextBlock>
                    <FN:TSFUC Grid.Column="1" dwFN="{Binding dwFN,ElementName=TV}"/>
                </Grid>
                <TextBox Text="{Binding HEADER, Source={StaticResource vwMaster}, Converter={StaticResource ResourceKey=gb2312}}" Width="100"></TextBox>
            </WrapPanel>
        </StackPanel>
        <DataGrid  Grid.Row="1"  VerticalAlignment="Top"  
                                   AutoGenerateColumns="False"
                                   EnableRowVirtualization="False"
                                   VerticalScrollBarVisibility="Auto"
                                   HorizontalScrollBarVisibility="Auto"
                                   HeadersVisibility="Column"     
                                   ItemsSource="{Binding Source={StaticResource ResourceKey=vwMaster}}"  
                                    IsSynchronizedWithCurrentItem="True"  
                                   RowDetailsVisibilityMode="Visible" 
                   Grid.ColumnSpan="2" Margin="0,0.2,0.2,0"
                    >
            <DataGrid.Columns> 
                <DataGridTextColumn   Binding="{Binding Path=ROWNID}"  Header="{Binding Source={Localization:Translate Word=ID}}"   Width="Auto" />
                <DataGridTextColumn   Binding="{Binding Path=COMPANY}" Header="{Binding Source={Localization:Translate Word=公司}}"  Width="Auto" />
                <DataGridTextColumn   Binding="{Binding Path=USERID}" Header="{Binding Source={Localization:Translate Word=用户}}"  Width="Auto" />
                <DataGridTextColumn   Binding="{Binding Path=TAG}" Header="{Binding Source={Localization:Translate Word=菜单项}}"  Width="Auto" /> 
                <DataGridTextColumn   Binding="{Binding Path=FATHER}" Header="{Binding Source={Localization:Translate Word=主菜单}}" Width="Auto" />
                <DataGridTextColumn   Binding="{Binding Path=HEADER, Converter={StaticResource ResourceKey=gb2312}}"  Header="{Binding Source={Localization:Translate Word=功能}}"
                                      Width="Auto" />   
            </DataGrid.Columns>
        </DataGrid  >
    </Grid>
</me:UIMENU> 
 
